/**
 * 
 */
package messaage;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

import forum.Thread;

/**
 * @author Olga
 * 
 */
public class CreatedThreadMsg extends Message {

	protected String threadContent;
        private boolean friendOrNot;
        private Thread thread;
        private String forumID;
        private String date;

	/**
	 * 
	 */


	
	public CreatedThreadMsg(Thread t, String forumID, boolean isFriend){
		this.thread = t;
		this.friendOrNot = isFriend;
		this.forumID = forumID;
		this.date = t.getRoot().getDate();
		this.threadContent = t.getRoot().getContent();
		this.type = "CreatedThreadMsg";
		
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see messaage.Message#toString()
	 */
	@Override
	public String toString() {
		XStream xstream = new XStream(new DomDriver());
		String xml = xstream.toXML(this)+"\0";
		
		return xml;
	}

	/**
	 * @return the threadContent
	 */
	public String getThreadContent() {
		return threadContent;
	}


        public boolean getIsFriend(){
            return this.friendOrNot;
        }

        public Thread getThread(){
            return this.thread;
        }

        public int getForumID(){
            return Integer.parseInt(forumID);
        }

        public String getDate(){
            return this.date;
        }



	
}
